﻿/***************************************************************************/
/// <summary>
///  <title>SLIC Settigns Model</title>
///  <description>Settigns Model for Enums settings </description>
///  <copyRight>Copyright (c) 2010</copyRight>
///  <company>IronOne Technologies (Pvt)Ltd</company>
///  <createdOn>2011-08-01</createdOn>
///  <author></author>
///  <modification>
///     <modifiedBy></modifiedBy>
///      <modifiedDate></modifiedDate>
///     <description></description>
///  </modification>
///
/// </summary>
/***************************************************************************/


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Reflection;
using System.EnterpriseServices;
using System.ComponentModel;
using SLIC.Models.EntityModel;
using System.Text;

namespace SLIC.Models.Enums
{
    public class Settings
    {
        public static string GetEnumDescription(Enum value)
        {
            FieldInfo fi = value.GetType().GetField(value.ToString());

            System.ComponentModel.DescriptionAttribute[] attributes =
                (System.ComponentModel.DescriptionAttribute[])fi.GetCustomAttributes(
                typeof(System.ComponentModel.DescriptionAttribute),
                false);

            if (attributes != null &&
                attributes.Length > 0)
                return attributes[0].Description;
            else
                return value.ToString();
        }
        /*
        public static string ProcessImageGalleryForTab(List<ImageGallery> images)
        {
           images= images.OrderBy(x => x.FieldId).ToList();

            StringBuilder sb = new StringBuilder();
            int fieldId = 0; int a = 0;
            int imageCount = images.Count();
            //int currentFieldId = 0;

            if (imageCount > 0)
            {
                foreach (ImageGallery item in images)
                {
                    if (fieldId != item.FieldId)
                    {
                        fieldId = item.FieldId;
                        if (a != 0)
                        {
                            sb.Append("},{" + fieldId + "," + item.ImageId);
                        }
                        else
                        {
                            sb.Append("{" + fieldId + "," + item.ImageId);
                        }
                        //sb.Append(",{" + fieldId + "," + item.ImageId);
                    }
                    else
                    {
                        sb.Append("," + item.ImageId);                       
                    }
                    if (a == (imageCount - 1))
                    {
                        sb.Append("}");
                    }
                    a++;
                }
            }

            return sb.ToString();
        }
        */
        public static string ProcessImageGalleryForTab(List<ImageGallery> images)
        {
            images = images.OrderBy(x => x.FieldId).ToList();

            StringBuilder sb = new StringBuilder();
            int fieldId = 0; int a = 0;
            int imageCount = images.Count();
            //int currentFieldId = 0;

            if (imageCount > 0)
            {
                foreach (ImageGallery item in images)
                {
                    if (fieldId != item.FieldId)
                    {
                        fieldId = item.FieldId;
                        if (a != 0)
                        {
                            // sb.Append("},{" + fieldId + "," + item.ImageId);
                            sb.Append(" | " + fieldId + "," + item.ImageId);
                        }
                        else
                        {
                            sb.Append(fieldId + "," + item.ImageId);
                            //sb.Append(",{" + fieldId + "," + item.ImageId);
                        }
                    }
                    else
                    {
                        sb.Append("," + item.ImageId);
                    }
                    //if (a == (imageCount - 1))
                    //{
                    //    sb.Append("}");
                    //}
                    a++;
                }
            }

            return sb.ToString();
        }
    }

    //public enum VehicleClass
    //{
    //    C = 1,
    //    C1,
    //    D
    //}

    public enum LogPoint
    {
        Entry = 0,
        Success,
        /*p3*/
        [System.ComponentModel.Description("File Uploaded")]
        FileUploaded,
        Failure
    }

    public enum LicenseType
    {
        Other = 0,
        MTA32,
        MTA39,
        CMT49,
        INTLIC
    }

    public enum LicenseIsNew
    {
        Old = 0,
        New = 1
    }

    public enum OldLicenseVehClasses
    {
        A1 = 1,
        A = 2,
        B1 = 3,
        B = 4,
        C1 = 5,
        C = 6,
        D = 7,
        E = 8,
        F = 9,
        G1 = 10,
        G = 11,
        H = 12
    }

    public enum NewLicenseVehClasses
    {
        A1 = 21,
        A = 22,
        B1 = 23,
        B = 24,
        C1 = 25,
        C = 26,
        CE = 27,
        D1 = 28,
        D = 29,
        DE = 30,
        G1 = 31,
        G = 32,
        J = 33
    }

    public enum JourneyPurpose
    {
        Private = 1,
        Hiring = 2,
        [System.ComponentModel.Description("Rent a Car")]
        RentACar = 3
    }

    public enum RelationshipType
    {
        Employee = 1,
        Spouse = 2,
        Relations = 3,
        Friend = 4,
        [System.ComponentModel.Description("No Relation")]
        NoRelation = 5
    }

    /*New Image Categories (from DLStatement) added by SLIC on phase 3 for resubmissions */
    public enum FieldName : byte
    {
        [System.ComponentModel.Description("Points Of Impact")]
        PointsOfImpact = 1,
        [System.ComponentModel.Description("Driver Statement")]
        DriverStatement,
        [System.ComponentModel.Description("Accident Images")]
        AccidentImages,
        [System.ComponentModel.Description("D/L Statement")]
        DLStatement,
        [System.ComponentModel.Description("Technical Officer Comments")]
        TechnicalOfficerComments,
        [System.ComponentModel.Description("Claim-form Images")]
        ClaimFormImage,
        [System.ComponentModel.Description("ARI")]
        ARI,
        [System.ComponentModel.Description("D/R")]
        DR,
        [System.ComponentModel.Description("Seen Visit")]
        SeenVisit,
        [System.ComponentModel.Description("Special Report 1")]
        SpecialReport1,
        [System.ComponentModel.Description("Special Report 2")]
        SpecialReport2,
        [System.ComponentModel.Description("Special Report 3")]
        SpecialReport3,
        [System.ComponentModel.Description("Supplementary 1")]
        Supplementary1,
        [System.ComponentModel.Description("Supplementary 2")]
        Supplementary2,
        [System.ComponentModel.Description("Supplementary 3")]
        Supplementary3,
        [System.ComponentModel.Description("Supplementary 4")]
        Supplementary4,
        Acknowledgment,
        [System.ComponentModel.Description("Salvage Report")]
        SalvageReport
    }

    public enum TyreConditon : byte
    {
        Good = 1,
        Fair,
        Bold
    }

    public enum Confirmation : byte
    {
        No = 0,
        Yes = 1
    }

    public enum CSR_Consistency : byte
    {
        Pending = 0,
        Yes = 1
    }

    public enum Vehicles : byte
    {
        Bus = 1,
        Car = 2,
        Lorry = 3,
        Van = 4,
        [System.ComponentModel.Description("Three Wheeler")]
        ThreeWheeler = 5,
        Motorcycle = 6
    }

    public enum OnSiteEstimation : byte
    {
        [System.ComponentModel.Description("Not Available")]
        NotAvailable = 0,
        Available = 1
    }

}